#include "tip_widget.h"

Tip_Widget::Tip_Widget(QWidget *parent):QWidget(parent)
{
    setFixedSize(550,280);

    m_move = false;
    icon_label = new QLabel(this);
    icon_label->setFixedSize(48,48);
    icon_label->setPixmap(QPixmap(":/qmfile/res/sp_icon.png"));

    app_name = new QLabel(this);
    app_name->setText(tr("Kylin operating system SP patch pack"));

    tip_label = new QLabel(this);
    tip_label->setText(tr("Suggestion: Backup your system before upgrading"));

    line_label = new QLabel(this);
    line_label->setFixedSize(180,1);

    upgrade_btn =new select_button();
    upgrade_btn->set_btn_name(tr("upgrade"));
    backups_btn =new select_button();
    backups_btn->set_btn_name(tr("backup"));

    QVBoxLayout *vlayout1 = new QVBoxLayout();
    vlayout1->addStretch();
    vlayout1->addWidget(app_name);
    vlayout1->addSpacing(15);
    vlayout1->addWidget(line_label);
    vlayout1->addSpacing(15);
    vlayout1->addWidget(tip_label);
    vlayout1->addStretch();
    QVBoxLayout *vlayout2 = new QVBoxLayout();
    vlayout2->addWidget(icon_label);
    vlayout2->addStretch();
    QHBoxLayout *hlayout1 = new QHBoxLayout();
    hlayout1->addSpacing(20);
    hlayout1->addLayout(vlayout2);
    hlayout1->addSpacing(20);
    hlayout1->addLayout(vlayout1);
    hlayout1->addStretch();

    QHBoxLayout *hlayout2 = new QHBoxLayout();
    hlayout2->addStretch();
    hlayout2->addWidget(backups_btn);
    hlayout2->addSpacing(15);
    hlayout2->addWidget(upgrade_btn);
    hlayout2->addSpacing(20);
    QVBoxLayout *vlayout3 = new QVBoxLayout();
    vlayout3->addLayout(hlayout1);
    vlayout3->addStretch();
    vlayout3->addLayout(hlayout2);
    vlayout3->addSpacing(25);
    vlayout3->setContentsMargins(0,44,0,0);
    setLayout(vlayout3);
    show();
}

Tip_Widget::~Tip_Widget()
{
    delete this;
}
